{strip}
{if (isset($content.userlevel) && $smarty.session.CMS.user_level >= $content.userlevel) OR !isset($content.userlevel)}
{else}
<div style="display:none;">
{/if}
	<div class="divFormFieldLabel" style="position:relative;">Bilder: <a href="javascript:void(0);" class="info">[?]<span>{$smarty.config.Forms_gallery_info}.</span></a></div>
	<div class="divFormFieldInput" id="div{$content.fieldname}_{$obj.obj_id}" style="position:relative;width:500px;">
		<div id="{$content.fieldname}_{$obj.obj_id}_container" {if !is_array($field.images)}style="display:none;"{/if}>	
			<h4 class="line">{$smarty.config.Forms_gallery_selected}</h4>
	 		<div id="GallerySortable_{$obj.obj_vers_id}_{$content.fieldname}" style="padding:2px;" class="gallery-view">
				{if is_array($field.images)}
					{foreach name="imageloopX" from=$field.images item=img}
						{include file="forms/gallery_append.tpl" img=$img obj=$obj fieldname=$content.fieldname prefix=$prefix count=$smarty.foreach.imageloopX.iteration}
					{/foreach}
					<div class="clear"></div>
				{/if}
			</div>
			<div class="clear"></div>
		</div>
		
{/strip}

		<h4 class="line">
			<span style="float:left;" onclick="CMS.open_upload('{$content.fieldname}_{$obj.obj_id}')">{$smarty.config.Forms_gallery_select_new}</span>
			<span style="float:right">
				<a href="javascript:void(0);" onclick="CMS.open_upload('{$content.fieldname}_{$obj.obj_id}')">{strip}
					{if is_array($field.images)}
					<img src="img/icon-formtype-open.gif" style="padding:0;margin:0;" id="{$content.fieldname}_{$obj.obj_id}_upload_switch" vspace="0" hspace="0" border="0" alt="" />
					{else}
					<img src="img/icon-formtype-close.gif" style="padding:0;margin:0;" id="{$content.fieldname}_{$obj.obj_id}_upload_switch" vspace="0" hspace="0" border="0" alt="" />
					{/if}
				{/strip}</a>
			</span>
			<div class="clear" style="margin:0;"></div>
		</h4>


	 	<div id="{$content.fieldname}_{$obj.obj_id}_upload" style="{if is_array($field.images)}display:none;{/if}">
			<br />
			{if ($smarty.session.CMS.user_level >= 1000) OR ($smarty.session.CMS.user_flags.general_filemanager)}
	
				<div style="float:left;width:140px;color:#333;font-size:12px;">{$smarty.config.Forms_gallery_upload_a}:</div>
				<div style="float:left;"><input style="width:85px;" type="button" value="{$smarty.config.Forms_gallery_select_image}" onclick="{strip}{literal}
	
						CMS.FileManager.open({
							{/literal}
							root:'media',
							project_id:'{$project_id}',
							multiple:true,
							{literal}
							post_params:{
							{/literal}
								type:'image',
								obj_id : '{$obj.obj_id}',
								fieldname : '{$content.fieldname}'
							{literal}
							},
							callback:{
								ccdsfun:'FileManagerReturnGallery',
								ccdsclass:'ccdsFileManager'
							},
							returnfield:{
							{/literal}
								container:xajax.$('{$content.fieldname}_{$obj.obj_id}_container'),
								img_container:xajax.$('GallerySortable_{$obj.obj_vers_id}_{$content.fieldname}')
							{literal}
							}
						});
					{/literal}{/strip}" />
			</div>
		{/if}
		{if !empty($content.default_path) || !empty($smarty.session.CMS.user_dir)}
			
			{if !empty($smarty.session.CMS.user_dir) AND !$smarty.session.CMS.user_flags.general_filemanager}
			
				{assign var="upload_dir" value=$smarty.session.CMS.user_dir}
				{assign var="rootdir" value="user"}
			{else}
				{assign var="upload_dir" value=$content.default_path}
				{assign var="rootdir" value="media"}
			{/if}
			{if ($smarty.session.CMS.user_level >= 1000) OR ($smarty.session.CMS.user_flags.general_filemanager)}
				<div class="clear" style="border-bottom:1px solid #d7d7d7;padding-top:10px;margin-bottom:10px;"></div>	
			{/if}

				<div style="float:left;width:140px;color:#333;font-size:12px;">{$smarty.config.Forms_file_upload_b}:</div>
				<div class="clear"></div>	
				<div>
					<div style="float:left;width:125px;margin-left:15px;">
						<h5>{$smarty.config.Forms_file_dest_folder}:</h5>
					</div>
					<div style="float:left;">
						{$smarty.config.Forms_file_upload_dir1}:<br />
						&quot;<span id="{$content.fieldname}_{$obj.obj_id}_path_label">{$upload_dir}&quot;</span><br />
						{if $smarty.session.CMS.user_flags.general_filemanager}
							(<a href="javascript:void(0);" onclick="{strip}
							{literal}xajax.request({
											ccdsfun:'FileManagerDirSelectorOpen',
											ccdsclass:'ccdsFileManager'	
							},
							{
								parameters:
									[
										{{/literal}
											root:'media',
											dir:'/',
											project_id:'{$project_id}',
											field:'{$content.fieldname}_{$obj.obj_id}_path'
										{literal}}
									]
								}
								);
							{/literal}{/strip}">{$smarty.config.Forms_file_change_dir}</a>){/if}<br />
					</div>
					<div class="clear"></div>	
			
					<div style="float:left;width:125px;margin-left:15px;">
						<h5>Dateiauswahl:</h5>
					</div>
					<div style="float:left;">
						<div>
							<input type="hidden" name="path" id="{$content.fieldname}_{$obj.obj_id}_path" value="{$upload_dir}" />
							<input type="input"  name="{$content.fieldname}_{$obj.obj_id}_multiup" id="{$content.fieldname}_{$obj.obj_id}_multiup" />
						</div>
			
						<input type="button" class="submitbtn" value="{$smarty.config.Forms_file_upload}" style="width:160px;" onclick="{strip}
							{literal}
					
								xajax.request(
									{
										ccdsclass:'ccdsContentEditor',
										ccdsfun:'ContentEditorGalleryUpload'
									},
									{
										parameters:[
											{{/literal}
												obj_id:{$obj.obj_id},
												obj_vers_id:xajax.$('obj_vers_id_{$obj.obj_id}').value,
												filefield:'{$content.fieldname}_{$obj.obj_id}_multiup',
												fieldname:'{$content.fieldname}',
												project_id:'{$project_id}',
												root:'{$rootdir}',
												path:xajax.$('{$content.fieldname}_{$obj.obj_id}_path').value
											{literal}}
										],
										mode:'SWFupload',
										SWFfield:'{/literal}{$content.fieldname}_{$obj.obj_id}_multiup{literal}',
										context: 
										{ 
											{/literal}
												container:xajax.$('{$content.fieldname}_{$obj.obj_id}_container'),
												img_container:xajax.$('GallerySortable_{$obj.obj_vers_id}_{$content.fieldname}')
											{literal} 
										}
									}
								);
							{/literal}
						{/strip}" />
					</div>
					<div class="clear"></div>	
				</div>
			{/if}
		</div>
	</div>
<br style="clear:both;" />

{if (isset($content.userlevel) && $smarty.session.CMS.user_level >= $content.userlevel) OR !isset($content.userlevel)}
{else}
</div>
{/if}
